<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/11/10
  Time: 14:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>学生列表</title>
    <style>
        li{
            list-style-type: none;
        }
        #ul_page li{

            float: left;
        }
        .active
        {
            color:red;
        }
        table td{
            border:1px solid cornflowerblue;
        }

    </style>
</head>
<body>
<div><a href="/student/to_add">添加学生</a> </div>
<div>
    <table>
        <tr><td>学号</td><td>姓名</td><td>性别</td><td>生日</td><td>专业</td></tr>
        <c:forEach items="${pageInfo.list }" var="stu">
            <tr><td>${stu.sno}</td><td>${stu.sname }</td><td>${stu.gender}</td><td>

                <fmt:formatDate value="${stu.birthday}" pattern="yyyy-MM-dd"/>     </td><td> ${stu.major}</td></tr>
        </c:forEach>
    </table>
</div>
<div>
    <ul id="ul_page">
        <li><a href="${pageContext.request.contextPath}/student/list?pageNum=1">首页</a>&nbsp;&nbsp;</li>
        <c:if test="${pageInfo.hasPreviousPage }">
            <li>
                <a href="${path }/student/list?pageNum=${pageInfo.pageNum-1}" >
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
        </c:if>
        <c:forEach items="${pageInfo.navigatepageNums }" var="page">
            <c:if test="${page==pageInfo.pageNum }">
                <li ><a style="color:red" href="${path }/student/list?pageNum=${page}">${page}</a>&nbsp;&nbsp;</li>
            </c:if>
            <c:if test="${page!=pageInfo.pageNum }">
                <li><a href="${pageContext.request.contextPath}/student/list?pageNum=${page}">${page}</a>&nbsp;&nbsp;</li>
            </c:if>
        </c:forEach>
        <c:if test="${pageInfo.hasNextPage }">
            <li>
                <a href="${pageContext.request.contextPath}/student/list?pageNum=${pageInfo.pageNum+1 }" >
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
        </c:if>

        <li><a href="${pageContext.request.contextPath}/student/list?pageNum=${pageInfo.pages}">末页</a></li>
    </ul>
</div>

<div style="clear: both">
    当前${pageInfo.pageNum }页，总共${pageInfo.pages }页，总共${pageInfo.total }条记录
</div>
</body>
</html>
